function hotel() {
    var destina_id = $('#hotel').attr('rel');
    $.ajax({
        url: links+"home/ajax/hotel",
        type: 'post',
        data : {destina_id:destina_id},
        success: function(data){
            $('.active').removeClass('active');
            $('#hotel').addClass('active');
            $('#countcon').html(data);
        }
    });
    return false;
}
function visa() {
    var destina_id = $('#visa').attr('rel');
    $.ajax({
        url: links+"home/ajax/visa",
        type: 'post',
        data : {destina_id:destina_id},
        success: function(data){
            $('.active').removeClass('active');
            $('#visa').addClass('active');
            $('#countcon').html(data);
        }
    });
    return false;
}
function place() {
    var destina_id = $('#place').attr('rel');
    $.ajax({
        url: links+"home/ajax/place",
        type: 'post',
        data : {destina_id:destina_id},
        success: function(data){
            $('.active').removeClass('active');
            $('#place').addClass('active');
            $('#countcon').html(data);
        }
    });
    return false;
}
function fact() {
    var destina_id = $('#fact').attr('rel');
    $.ajax({
        url: links+"home/ajax/fact",
        type: 'post',
        data : {destina_id:destina_id},
        success: function(data){
            $('.active').removeClass('active');
            $('#fact').addClass('active');
            $('#countcon').html(data);
        }
    });
    return false;
}// JavaScript Document
function sorttype(that) {
        var $show = $("#hotourscon");
        var $destina_id = $("#iddes").val();
        $val = $(that).val();
        var $tour = $("#tour_dura").val();
        if($val == 0){
            //window.location.reload();
        }else{
            $.ajax({
                url: links+"home/ajax/short_tour",
                type:"POST",
                data:"type="+$val+"&destina="+$destina_id+"&tour="+$tour,
                async:false,
                success:function (result) {
                    $show.html(result);
                }
            });
        }
        return false;
    }
function sortdura(that) {
	var $show = $("#hotourscon");
	var $destina_id = $("#iddes").val();
	var type = $("#tour_type").val();
	$val = $(that).val();
	if(type ==0 ){
		alert("Please select holiday types");
	}else{
		$.ajax({
			url:links+"home/ajax/short_dura",
			type:"POST",
			data:"tour="+$val+"&destina="+$destina_id+"&type="+type,
			success:function (result) {
				$show.html(result);
			}
		});
	}
	return false;
}
function pagehotel(that) {
	var start = $(that).attr('name');
	var type = $(that).attr('rel');
	$.ajax({
		url:links+"home/ajax/page_hotel",
		type:"post",
		data:{start:start,type:type},
		async:false,
		success:function (result) {
			$("#countcon").html(result);
		}
	});
}
function pageregion(that) {
	var start = $(that).attr('name');
	var type = $(that).attr('rel');
	$.ajax({
		url:links+"home/ajax/page_region",
		type:"post",
		data:{start:start,type:type},
		async:false,
		success:function (result) {
			$("#countcon").html(result);
		}
	});
}
function pages(that) {
	var start = $(that).attr('name');
	var type = $(that).attr('rel');
	var destina_id = $(that).attr('rel2');
	$.ajax({
		url:links+"home/ajax/ajax_tour",
		type:"post",
		data:{start:start,type:type, destina:destina_id},
		async:false,
		success:function (result) {
			$("#hotourscon").html(result);
		}
	});
}
function ashowvisa(){
    $('#visashow').show();
    $('#visahiden').hide();
}
function ques(){
    var nameq = $('#nameq').val();
    if(nameq == '') {
        alert('You must fill in this place');
        $('#nameq').focus();
        return false;
    }
    var mailq = $('#mailq').val();
    if(checkEmail(mailq) == false){
        $('#mailq').focus();
        alert('Invalid email address');
        return false;
    }
    var content = $('#ctq').val();
    if(content == '') {
        alert('You must fill in this place');
        $('#ctq').focus();
        return false;
    }
    $.ajax({
        url: links+"home/ques/add",
        type: 'post',
        data:{content:content, nameq:nameq, mailq:mailq},
        success: function(data){
            var name_q = $('#nameq').val('');
            var email_q = $('#mailq').val('');
			$('#ctq').val('');
            alert("Thank you for your enquiry, we will contact you at the soonest!");
        }
    });
    return false;
}
function checkEmail(inputvalue){
    var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
    if(pattern.test(inputvalue)){
        return true;
    }else{
        return false;
    }
}